<template>
<div class="vertify timeline-demo">
<timeline>
			<timeline-item>
				<h4  v-bind:class="{recent: go }">身份认证</h4>
				<p v-bind:class="{recent: go }" >2016-04-17 12:00:00</p>
			</timeline-item>
			<timeline-item>
        <h4 v-bind:class="{recent: !go }">银行卡绑定</h4>
				<p v-bind:class="{recent: !go }">2016-04-16 10:23:00</p>
			</timeline-item>

		</timeline>

		<group v-if="go">
			<x-input
			 title="姓名"
    v-model="postData.identityName"
		:show-clear=true
		placeholder="张山"></x-input><x-input
	title="身份证号"
 v-model="postData.identityNo"
 :show-clear=true
 placeholder="0000000"></x-input>
		</group>
<group v-else>
  <x-input
title="银行卡号"
     :show-clear=true
     v-model="postData.bankCardNo"
     placeholder="0000000"></x-input>
   <!-- <x&#45;input -->
   <!--   title="银行预留的手机号:" -->
   <!--   :show&#45;clear=true -->
   <!--   placeholder="0000000"></x&#45;input> -->
		</group>

		<x-button type="warn" v-if="go" @click.native="togglenext">下一步</x-button>
		<x-button type="warn" v-else  @click.native="vertify">认证</x-button>
</div>
</template>
<script>
import store from './mystore.js'
import { Timeline, TimelineItem, XButton,XInput ,Group, Cell} from 'vux'
export default {
    data (){
    return {
      count: 3,
      go: true,
      postData:{"identityName":"","identityNo":"","bankCardNo":""}
    }
    },
    components: {

    Timeline,
    TimelineItem,
    XButton,
    XInput,
      Group
    },
    methods: {
      togglenext (){
        this.go = false
      },
      vertify (){
let xx = localStorage.getItem('sessionId')

        let x = {"identityName":"222","identityNo":"233","bankCardNo":"33"}
        console.info(this.postData, 'yao!');
        this.$http.post(store.vertifyCard.url,this.postData,{headers: {
        merchantSessionId: xx    }}).then(res => { console.info(res,"verytifycard success!");
if(res.body.returnCode == 0)
				console.error('eeeeeee');
		{
			this.$router.push('/Passing')
		}
}).then(err => {console.error(err);})
      }
}
}
</script>
<style lang="less">
.vertify .weui-btn { background:@main-color ;}
.timeline-demo {
	p {
		color: #888;
		font-size: 0.8rem;
	}
	h4 {
		color: #666;
		font-weight: normal;
	}
	.recent {
		color: rgb(4, 190, 2)
	}
}

</style>
